function solution(s) {
    // write code here
    let i = 0
    while (s[i] === '0') {
        i++
    }
    s = s.slice(i)
    let a = s.split('.')
    const len = a[0].length
    let zhengshu = a[0]
    let str = ''
    let result = ''
    for (let n = len - 1; n >= 0; n--) {
        str = zhengshu[n] + str
        if ((len - n) % 3 === 0 && n !== 0) {
            str = ',' + str
        }
    }
    if (a[1]) {
        result = str + '.' + a[1]
    } else {
        result = str
    }
    return result
}

function main() {
    console.log(solution("1294512.12412") === '1,294,512.12412');
    console.log(solution("0000123456789.99") === '123,456,789.99');
    console.log(solution("987654321") === '987,654,321');
}

main();